package com.forever.okhttpdemo.thread;


import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.forever.okhttpdemo.http.HttpUrl;

import android.content.Context;
import android.os.AsyncTask;
import android.widget.Toast;

public class CustomPostFileAsyncTask extends AsyncTask<String, Void, byte[]> {
	private Context context;

	public CustomPostFileAsyncTask(Context context) {
		this.context = context;

	}

	@Override
	protected byte[] doInBackground(String... params) {

		byte[] mbyte = null;

		// InputStream is = HttpUrl.loadFileFromURLPost(params[0], "wy", "123");
		//
		// try {
		// mbyte = HttpUrl.InputStreamToByteArray(is);
		// } catch (IOException e) {
		// // TODO Auto-generated catch block
		// e.printStackTrace();
		// }

		return mbyte;
	}

	@Override
	protected void onPostExecute(byte[] result) {
		super.onPostExecute(result);
		if (result != null) {

			Toast.makeText(context, new String(result), 0).show();
		} else {
			Toast.makeText(context, "失败", 0).show();
		}
	}

}
